package io.bsly.modules.app.service.localmaster.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.bsly.common.utils.PageUtils;
import io.bsly.common.utils.Query;
import io.bsly.modules.app.dao.localDao.DyOfficalOrderDao;
import io.bsly.modules.app.entity.localEntity.DyOfficalOrderEntity;
import io.bsly.modules.app.service.localmaster.DyOfficalOrderService;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("dyOfficalOrderService")
public class DyOfficalOrderServiceImpl extends ServiceImpl<DyOfficalOrderDao, DyOfficalOrderEntity> implements DyOfficalOrderService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<DyOfficalOrderEntity> page = this.page(
                new Query<DyOfficalOrderEntity>().getPage(params),
                new QueryWrapper<DyOfficalOrderEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public DyOfficalOrderEntity getByCouponNo(String coupenNo) {
       return this.getOne(new LambdaQueryWrapper<DyOfficalOrderEntity>().eq(DyOfficalOrderEntity::getWriteoffNo,coupenNo));
    }

}